<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Capitalize extends Model
{
    use HasFactory;


    protected $fillable = ['name','project_capitalize_id','amount','interest_rate','installments','monthly_payment','principal','total_interest','remarks','files'];

    const POSTONLY = ['name','project_capitalize_id','amount','interest_rate','installments','monthly_payment','principal','total_interest','remarks','files'];

    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

    public function projectCapitalize()
    {
        return $this->hasOne(projectCapitalize::class,'project_capitalize_id','id');
    }
}
